{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=344
  Verdict: Accepted
}
uses 
	SysUtils, Math;
 
var
	s:string;
 
function BinToInt(B:string):Int64;
var i:byte; k:longint;
begin
result:=0;
k:=length(b);
for i:=1 to k do result:=(result shl 1)+(byte(B[i]) and 1);
end;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
readln(s);
write(bintoint(s));
end.